#include <iostream>
#include <opencv2/opencv.hpp>
#include <fstream>
using namespace std;


int main() {
    cv::Mat gray;
    gray.create(20,60,CV_8UC1);

    ifstream fin("/media/st/Application/0NRSL_data/hit_campus/sci_database/pc_1_1_6_1.csv"); //打开文件流操作
    string line;
    int row=0;
    while (getline(fin, line))   //整行读取，换行符“\n”区分，遇到文件尾标志eof终止读取
    {
        //cout <<"原始字符串："<< line << endl; //整行输出
        istringstream sin(line); //将整行字符串line读入到字符串流istringstream中
        vector<string> fields; //声明一个字符串向量
        string field;
        int col=0;
        while (getline(sin, field, ',')) //将字符串流sin中的字符读入到field字符串中，以逗号为分隔符
        {
            gray.at<uint8_t>(row,col)=strtoul(field.c_str(), NULL, 10);;
            col++;
//            cout <<"yussu："<< field;
        }
        row++;
    }
    cv::Mat rgb;
    cv::applyColorMap(gray,rgb,cv::COLORMAP_JET);
    cv::imshow("rgb",rgb);
    cout<<rgb<<endl;
    cv::Mat matlab_rgb;
    matlab_rgb=cv::imread("/media/st/Application/0NRSL_data/hit_campus/sci_rgb/pc_1_1_6_1_f.png");
    cout<<"mat"<<matlab_rgb<<endl;
    cv::waitKey(0);
    //cout<<gray<<endl;
    return 0;
}